import numpy as np
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
import math as mt
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)
fp_padrao = 0.92
fp_padrao_Sup = 2-fp_padrao
def normaliza(s):
if s >= 0:
return s
elif s < 0:
return s + 2
def negativo(a):
if a >= 0:
return a
elif a < 0:
return a*-1
def porcentagem(a, b):
c = a*100/b
return c
def DirunoNoturno():
exceldados = pd.ExcelWriter('ComercialAnalise.xlsx',
engine='xlsxwriter',
datetime_format='mmm-d-yyyy hh:mm:ss',
date_format='mmmm-dd-yyyy',)
Subestação.round(5).to_excel(exceldados, sheet_name='Subestação')
FonseTotal.round(5).to_excel(exceldados, sheet_name='Fonse')
FonseFreezer.round(5).to_excel(exceldados, sheet_name='Freezer')
DiurnoSubestação.round(5).to_excel(
exceldados, sheet_name='Diurno Subestação')
NoturnoSubestação.round(5).to_excel(
exceldados, sheet_name='Noturno Subestação')
DiurnoFonse.round(5).to_excel(exceldados, sheet_name='Diurno Fonse')
NoturnoFonse.round(5).to_excel(exceldados, sheet_name='Noturno Fonse')
DiurnoFreezer.round(5).to_excel(exceldados, sheet_name='Diurno Freezer')
NoturnoFreezer.round(5).to_excel(exceldados, sheet_name='Noturno Freezer')
exceldados.save()
def potenciaParcial(p):
maximo = p.cumsum().max()
minimo = p.cumsum().min()
amostras = p.count()
resultado = maximo/amostras
return resultado
def Horas(Maximo, Minimo):
Resultado = Maximo - Minimo
ResultadosD = pd.to_numeric(Resultado.days, downcast='integer')
ResultadoS = pd.to_numeric(Resultado.seconds, downcast='integer')
Res = (ResultadoS/3600) + (ResultadosD * 24)
return Res
FonseTotal = pd.read_excel(
'9_10_11 de março analisador.xlsx', sheet_name='Fonse Total')
FonseFreezer = pd.read_excel(
'9_10_11 de março analisador.xlsx', sheet_name='Freezers Fonse')
Subestação = pd.read_excel(
'9_10_11 de março analisador.xlsx', sheet_name='Subestação Energia')
Fotovoltaico = pd.read_excel('GeraçãoFotovoltaica.xlsx', sheet_name='valores')
CorrenteRFonseTotal = FonseTotal['Corrente R'].mean()
CorrenteSFonseTotal = FonseTotal['Corrente S'].mean()
CorrenteTFonseTotal = FonseTotal['Corrente T'].mean()
Subestação['Data'] = pd.to_datetime(Subestação['Data'])
FonseTotal['Data'] = pd.to_datetime(FonseTotal['Data'])
FonseFreezer['Data'] = pd.to_datetime(FonseFreezer['Data'])
Fotovoltaico['Data'] = pd.to_datetime(Fotovoltaico['Data'])
Fotovoltaico['Corrente R'] = Fotovoltaico['Inversor A - Corrente Fase A'] + \
Fotovoltaico['Inversor B - Corrente Fase A'] + \
Fotovoltaico['Inversor C - Corrente Fase A']
Fotovoltaico['Corrente S'] = Fotovoltaico['Inversor A - Corrente Fase B'] + \
Fotovoltaico['Inversor B - Corrente Fase B'] + \
Fotovoltaico['Inversor C - Corrente Fase B']
Fotovoltaico['Corrente T'] = Fotovoltaico['Inversor A - Corrente Fase C'] + \
Fotovoltaico['Inversor B - Corrente Fase C'] + \
Fotovoltaico['Inversor C - Corrente Fase C']
FonseTotal['Pot R KVA'] = (FonseTotal['Corrente R']
* FonseTotal['Tensão R'] * (mt.sqrt(3)))/1000
FonseTotal['Pot S KVA'] = (FonseTotal['Corrente S']
* FonseTotal['Tensão S'] * (mt.sqrt(3)))/1000
FonseTotal['Pot T KVA'] = (FonseTotal['Corrente T']
* FonseTotal['Tensão T'] * (mt.sqrt(3)))/1000
FonseFreezer['Pot R KVA'] = (
FonseFreezer['Corrente R'] * FonseFreezer['Tensão R'] * (mt.sqrt(3)))/1000
FonseFreezer['Pot S KVA'] = (
FonseFreezer['Corrente S'] * FonseFreezer['Tensão S'] * (mt.sqrt(3)))/1000
FonseFreezer['Pot T KVA'] = (
FonseFreezer['Corrente T'] * FonseFreezer['Tensão T'] * (mt.sqrt(3)))/1000
Subestação['Pot R KVA'] = (Subestação['Corrente R']
* Subestação['Tensão R'] * (mt.sqrt(3)))/1000
Subestação['Pot S KVA'] = (Subestação['Corrente S']
* Subestação['Tensão S'] * (mt.sqrt(3)))/1000
Subestação['Pot T KVA'] = (Subestação['Corrente T']
* Subestação['Tensão T'] * (mt.sqrt(3)))/1000
# Calculo KVAr usando numpy
FonseTotal['Pot R KW'] = (FonseTotal['Pot R KVA'] * (FonseTotal['Fat Pot R']))
FonseTotal['Pot S KW'] = (FonseTotal['Pot S KVA'] * (FonseTotal['Fat Pot S']))
FonseTotal['Pot T KW'] = (FonseTotal['Pot T KVA'] * (FonseTotal['Fat Pot T']))
FonseFreezer['Pot R KW'] = (
FonseFreezer['Pot R KVA'] * (FonseFreezer['Fat Pot R']))
FonseFreezer['Pot S KW'] = (
FonseFreezer['Pot S KVA'] * (FonseFreezer['Fat Pot S']))
FonseFreezer['Pot T KW'] = (
FonseFreezer['Pot T KVA'] * (FonseFreezer['Fat Pot T']))
Subestação['Pot R KW'] = (Subestação['Pot R KVA'] * (Subestação['Fat Pot R']))
Subestação['Pot S KW'] = (Subestação['Pot S KVA'] * (Subestação['Fat Pot S']))
Subestação['Pot T KW'] = (Subestação['Pot T KVA'] * (Subestação['Fat Pot T']))
# Calculo KVAr usando numpy
FonseTotal['Pot R KVAr'] = np.sqrt(
np.power(FonseTotal['Pot R KVA'], 2) - np.power(FonseTotal['Pot R KW'], 2))
FonseTotal['Pot S KVAr'] = np.sqrt(
np.power(FonseTotal['Pot S KVA'], 2) - np.power(FonseTotal['Pot S KW'], 2))
FonseTotal['Pot T KVAr'] = np.sqrt(
np.power(FonseTotal['Pot T KVA'], 2) - np.power(FonseTotal['Pot T KW'], 2))
FonseFreezer['Pot R KVAr'] = np.sqrt(
np.power(FonseFreezer['Pot R KVA'], 2) - np.power(FonseFreezer['Pot R KW'], 2))
FonseFreezer['Pot S KVAr'] = np.sqrt(
np.power(FonseFreezer['Pot S KVA'], 2) - np.power(FonseFreezer['Pot S KW'], 2))
FonseFreezer['Pot T KVAr'] = np.sqrt(
np.power(FonseFreezer['Pot T KVA'], 2) - np.power(FonseFreezer['Pot T KW'], 2))
Subestação['Pot R KVAr'] = np.sqrt(
np.power(Subestação['Pot R KVA'], 2) - np.power(Subestação['Pot R KW'], 2))
Subestação['Pot S KVAr'] = np.sqrt(
np.power(Subestação['Pot S KVA'], 2) - np.power(Subestação['Pot S KW'], 2))
Subestação['Pot T KVAr'] = np.sqrt(
np.power(Subestação['Pot T KVA'], 2) - np.power(Subestação['Pot T KW'], 2))
# Calculo Faltante Kvar
FonseTotal['Pot R KVAr faltante'] = (FonseTotal['Pot R KVAr']) - (np.sqrt(np.power(FonseTotal['Pot R KVA'], 2) -
(np.power((FonseTotal['Pot R KVA'] * (fp_padrao)), 2))))
FonseTotal['Pot S KVAr faltante'] = (FonseTotal['Pot S KVAr']) - (np.sqrt(np.power(FonseTotal['Pot S KVA'], 2) -
(np.power((FonseTotal['Pot S KVA'] * (fp_padrao)), 2))))
FonseTotal['Pot T KVAr faltante'] = (FonseTotal['Pot T KVAr']) - (np.sqrt(np.power(FonseTotal['Pot T KVA'], 2) -
(np.power((FonseTotal['Pot T KVA'] * (fp_padrao)), 2))))
FonseFreezer['Pot R KVAr faltante'] = (FonseFreezer['Pot R KVAr']) - (np.sqrt(np.power(FonseFreezer['Pot R KVA'], 2) -
(np.power((FonseFreezer['Pot R KVA'] * (fp_padrao)), 2))))
FonseFreezer['Pot S KVAr faltante'] = (FonseFreezer['Pot S KVAr']) - (np.sqrt(np.power(FonseFreezer['Pot S KVA'], 2) -
(np.power((FonseFreezer['Pot S KVA'] * (fp_padrao)), 2))))
FonseFreezer['Pot T KVAr faltante'] = (FonseFreezer['Pot T KVAr']) - (np.sqrt(np.power(FonseFreezer['Pot T KVA'], 2) -
(np.power((FonseFreezer['Pot T KVA'] * (fp_padrao)), 2))))
Subestação['Pot R KVAr faltante'] = (Subestação['Pot R KVAr']) - (np.sqrt(np.power(Subestação['Pot R KVA'], 2) -
(np.power((Subestação['Pot R KVA'] * (fp_padrao)), 2))))
Subestação['Pot S KVAr faltante'] = (Subestação['Pot S KVAr']) - (np.sqrt(np.power(Subestação['Pot S KVA'], 2) -
(np.power((Subestação['Pot S KVA'] * (fp_padrao)), 2))))
Subestação['Pot T KVAr faltante'] = (Subestação['Pot T KVAr']) - (np.sqrt(np.power(Subestação['Pot T KVA'], 2) -
(np.power((Subestação['Pot T KVA'] * (fp_padrao)), 2))))
FonseTotal['Fat Pot R'] = FonseTotal['Fat Pot R'].apply(normaliza)
FonseTotal['Fat Pot S'] = FonseTotal['Fat Pot S'].apply(normaliza)
FonseTotal['Fat Pot T'] = FonseTotal['Fat Pot T'].apply(normaliza)
FonseFreezer['Fat Pot R'] = FonseFreezer['Fat Pot R'].apply(normaliza)
FonseFreezer['Fat Pot S'] = FonseFreezer['Fat Pot S'].apply(normaliza)
FonseFreezer['Fat Pot T'] = FonseFreezer['Fat Pot T'].apply(normaliza)
Subestação['Fat Pot R'] = Subestação['Fat Pot R'].apply(normaliza)
Subestação['Fat Pot S'] = Subestação['Fat Pot S'].apply(normaliza)
Subestação['Fat Pot T'] = Subestação['Fat Pot T'].apply(normaliza)
Subestação['Pot R KW'] = Subestação['Pot R KW'].apply(negativo)
Subestação['Pot S KW'] = Subestação['Pot S KW'].apply(negativo)
Subestação['Pot T KW'] = Subestação['Pot T KW'].apply(negativo)
FonseFreezer['Pot R KW'] = FonseFreezer['Pot R KW'].apply(negativo)
FonseFreezer['Pot S KW'] = FonseFreezer['Pot S KW'].apply(negativo)
FonseFreezer['Pot T KW'] = FonseFreezer['Pot T KW'].apply(negativo)
FonseTotal['Pot R KW'] = FonseTotal['Pot R KW'].apply(negativo)
FonseTotal['Pot S KW'] = FonseTotal['Pot S KW'].apply(negativo)
FonseTotal['Pot T KW'] = FonseTotal['Pot T KW'].apply(negativo)
FonseFreezer.drop('Ocorrência', axis=1, inplace=True)
FonseFreezer.drop('Freqüência', axis=1, inplace=True)
FonseTotal.drop('Ocorrência', axis=1, inplace=True)
FonseTotal.drop('Freqüência', axis=1, inplace=True)
Subestação.drop('Ocorrência', axis=1, inplace=True)
Subestação.drop('Freqüência', axis=1, inplace=True)
DiurnoSubestação = Subestação.loc[(
(Subestação['Data'] >= '2020-03-09 07:00') & (Subestação['Data'] <= '2020-03-09 19:00'))]
DiurnoFonse = FonseTotal.loc[(
(FonseTotal['Data'] >= '2020-03-10 07:00') & (FonseTotal['Data'] <= '2020-03-10 19:00'))]
DiurnoFreezer = FonseFreezer.loc[(
(FonseFreezer['Data'] >= '2020-03-11 07:00') & (FonseFreezer['Data'] <= '2020-03-11 19:00'))]
NoturnoSubestação = Subestação.loc[(
(Subestação['Data'] >= '2020-03-09 19:00') & (Subestação['Data'] <= '2020-03-10 07:00'))]
NoturnoFonse = FonseTotal.loc[(
(FonseTotal['Data'] >= '2020-03-10 19:00') & (FonseTotal['Data'] <= '2020-03-11 07:00'))]
NoturnoFreezer = FonseFreezer.loc[(
(FonseFreezer['Data'] >= '2020-03-11 19:00') & (FonseFreezer['Data'] <= '2020-03-12 07:00'))]
PrimeiroDia = Fotovoltaico.loc[(
(Fotovoltaico['Data'] >= '2020-03-09 00:00') & (Fotovoltaico['Data'] <= '2020-03-09 23:59'))]
SegundoDia = Fotovoltaico.loc[(
(Fotovoltaico['Data'] >= '2020-03-10 00:00') & (Fotovoltaico['Data'] <= '2020-03-10 23:59'))]
TerceiroDia = Fotovoltaico.loc[(
(Fotovoltaico['Data'] >= '2020-03-11 00:00') & (Fotovoltaico['Data'] <= '2020-03-11 23:59'))]
Corrente e Geração Fotovoltaica
layout = go.Layout(title='Correntes - Comparações',
xaxis={'title': 'Data'},
yaxis={'title': 'Corrente'})
trace = go.Scatter(y=Subestação['Corrente R'],
x=Subestação['Data'],
mode='lines',
name='Corrente R - Subestação Grafico')
trace1 = go.Scatter(y=Subestação['Corrente S'],
x=Subestação['Data'],
mode='lines',
name='Corrente S - Subestação Grafico')
trace2 = go.Scatter(y=Subestação['Corrente T'],
x=Subestação['Data'],
mode='lines',
name='Corrente T - Subestação Grafico')
trace3 = go.Scatter(y=PrimeiroDia['Corrente R'],
x=PrimeiroDia['Data'],
mode='lines',
name='Corrente R - Geração Fotovoltáica')
trace4 = go.Scatter(y=PrimeiroDia['Corrente S'],
x=PrimeiroDia['Data'],
mode='lines',
name='Corrente S - Geração Fotovoltáica')
trace5 = go.Scatter(y=PrimeiroDia['Corrente T'],
x=PrimeiroDia['Data'],
mode='lines',
name='Corrente T - Geração Fotovoltáica')
data = [trace, trace1, trace2, trace3, trace4, trace5]
fig = go.Figure(data=data, layout=layout)
py.iplot(fig)
Corrente e Geração Fotovoltaica
layout = go.Layout(title='Correntes - Comparações',
xaxis={'title': 'Data'},
yaxis={'title': 'Corrente'})
trace = go.Scatter(y=FonseTotal['Corrente R'],
x=FonseTotal['Data'],
mode='lines',
name='Corrente R - Fonse Grafico')
trace1 = go.Scatter(y=FonseTotal['Corrente S'],
x=FonseTotal['Data'],
mode='lines',
name='Corrente S - Fonse Grafico')
trace2 = go.Scatter(y=FonseTotal['Corrente T'],
x=FonseTotal['Data'],
mode='lines',
name='Corrente T - Fonse Grafico')
trace3 = go.Scatter(y=SegundoDia['Corrente R'],
x=SegundoDia['Data'],
mode='lines',
name='Corrente R - Geração Fotovoltáica')
trace4 = go.Scatter(y=SegundoDia['Corrente S'],
x=SegundoDia['Data'],
mode='lines',
name='Corrente S - Geração Fotovoltáica')
trace5 = go.Scatter(y=SegundoDia['Corrente T'],
x=SegundoDia['Data'],
mode='lines',
name='Corrente T - Geração Fotovoltáica')
data = [trace, trace1, trace2, trace3, trace4, trace5]
fig = go.Figure(data=data, layout=layout)
py.iplot(fig)
Corrente Freezer
layout = go.Layout(title='Correntes - Comparações',
xaxis={'title': 'Data'},
yaxis={'title': 'Corrente'})
trace = go.Scatter(y=FonseFreezer['Corrente R'],
x=FonseFreezer['Data'],
mode='lines',
name='Corrente R - Freezer Grafico')
trace1 = go.Scatter(y=FonseFreezer['Corrente S'],
x=FonseFreezer['Data'],
mode='lines',
name='Corrente S - Freezer Grafico')
trace2 = go.Scatter(y=FonseFreezer['Corrente T'],
x=FonseFreezer['Data'],
mode='lines',
name='Corrente T - Freezer Grafico')
'''
trace3 = go.Scatter(y = TerceiroDia['Corrente R'],
x = TerceiroDia['Data'],
mode = 'lines',
name = 'Corrente R - Geração Fotovoltáica')
trace4 = go.Scatter(y = TerceiroDia['Corrente S'],
x = TerceiroDia['Data'],
mode = 'lines',
name = 'Corrente S - Geração Fotovoltáica')
trace5 = go.Scatter(y = TerceiroDia['Corrente T'],
x = TerceiroDia['Data'],
mode = 'lines',
name = 'Corrente T - Geração Fotovoltáica')
'''
data = [trace, trace1, trace2]
fig = go.Figure(data=data, layout=layout)
py.iplot(fig)
'''
Detalhes Técnicos de Ajuste de corrente
'''
MediaCorrenteSubR = Subestação['Corrente R'].mean()
MediaCorrenteSubS = Subestação['Corrente S'].mean()
MediaCorrenteSubT = Subestação['Corrente T'].mean()
MediaCorrenteFonseR = FonseTotal['Corrente R'].mean()
MediaCorrenteFonseS = FonseTotal['Corrente S'].mean()
MediaCorrenteFonseT = FonseTotal['Corrente T'].mean()
MediaCorrenteFreezerR = FonseFreezer['Corrente R'].mean()
MediaCorrenteFreezerS = FonseFreezer['Corrente S'].mean()
MediaCorrenteFreezerT = FonseFreezer['Corrente T'].mean()
MediaCorrenteDSubR = DiurnoSubestação['Corrente R'].mean()
MediaCorrenteDSubS = DiurnoSubestação['Corrente S'].mean()
MediaCorrenteDSubT = DiurnoSubestação['Corrente T'].mean()
MediaCorrenteDFonseR = DiurnoFonse['Corrente R'].mean()
MediaCorrenteDFonseS = DiurnoFonse['Corrente S'].mean()
MediaCorrenteDFonseT = DiurnoFonse['Corrente T'].mean()
MediaCorrenteDFreezerR = DiurnoFreezer['Corrente R'].mean()
MediaCorrenteDFreezerS = DiurnoFreezer['Corrente S'].mean()
MediaCorrenteDFreezerT = DiurnoFreezer['Corrente T'].mean()
MediaCorrenteNSubR = NoturnoSubestação['Corrente R'].mean()
MediaCorrenteNSubS = NoturnoSubestação['Corrente S'].mean()
MediaCorrenteNSubT = NoturnoSubestação['Corrente T'].mean()
MediaCorrenteNFonseR = NoturnoFonse['Corrente R'].mean()
MediaCorrenteNFonseS = NoturnoFonse['Corrente S'].mean()
MediaCorrenteNFonseT = NoturnoFonse['Corrente T'].mean()
MediaCorrenteNFreezerR = NoturnoFreezer['Corrente R'].mean()
MediaCorrenteNFreezerS = NoturnoFreezer['Corrente S'].mean()
MediaCorrenteNFreezerT = NoturnoFreezer['Corrente T'].mean()
MediaCorrenteRPrimeiroD = PrimeiroDia['Corrente R'].mean()
MediaCorrenteSPrimeiroD = PrimeiroDia['Corrente S'].mean()
MediaCorrenteTPrimeiroD = PrimeiroDia['Corrente T'].mean()
MediaCorrenteRSegundoD = SegundoDia['Corrente R'].mean()
MediaCorrenteSSegundoD = SegundoDia['Corrente S'].mean()
MediaCorrenteTSegundoD = SegundoDia['Corrente T'].mean()
MediaCorrenteRTerceiroD = TerceiroDia['Corrente R'].mean()
MediaCorrenteSTerceiroD = TerceiroDia['Corrente S'].mean()
MediaCorrenteTTerceiroD = TerceiroDia['Corrente T'].mean()
MediaCorrenteDTotalSub = (
MediaCorrenteDSubR + MediaCorrenteDSubS + MediaCorrenteDSubT)/3
MediaCorrenteDTotalFonse = (
MediaCorrenteDFonseR + MediaCorrenteDFonseS + MediaCorrenteDFonseT)/3
MediaCorrenteDTotalFreezer = (
MediaCorrenteDFreezerR + MediaCorrenteDFreezerS + MediaCorrenteDFreezerT)/3
MediaCorrenteNTotalSub = (
MediaCorrenteNSubR + MediaCorrenteNSubS + MediaCorrenteNSubT)/3
MediaCorrenteNTotalFonse = (
MediaCorrenteNFonseR + MediaCorrenteNFonseS + MediaCorrenteNFonseT)/3
MediaCorrenteNTotalFreezer = (
MediaCorrenteNFreezerR + MediaCorrenteNFreezerS + MediaCorrenteNFreezerT)/3
MediaCorrenteTotalSub = (
MediaCorrenteSubR + MediaCorrenteSubS + MediaCorrenteSubT)/3
MediaCorrenteTotalFonse = (MediaCorrenteFonseR +
MediaCorrenteFonseS + MediaCorrenteFonseT)/3
MediaCorrenteTotalFreezer = (
MediaCorrenteFreezerR + MediaCorrenteFreezerS + MediaCorrenteFreezerT)/3
MediaCorrenteTotalPrimeiroD = (
MediaCorrenteRPrimeiroD + MediaCorrenteSPrimeiroD + MediaCorrenteTPrimeiroD)/3
MediaCorrenteTotalSegundoD = (
MediaCorrenteRSegundoD + MediaCorrenteSSegundoD + MediaCorrenteTSegundoD)/3
MediaCorrenteTotalTerceiroD = (
MediaCorrenteRTerceiroD + MediaCorrenteSTerceiroD + MediaCorrenteTTerceiroD)/3
Fonse_SubestaçãoDiurno = porcentagem(
MediaCorrenteDTotalFonse, MediaCorrenteDTotalSub)
Freezer_FonseDiurno = porcentagem(
MediaCorrenteDTotalFreezer, MediaCorrenteDTotalFonse)
Fonse_SubestaçãoNoturno = porcentagem(
MediaCorrenteNTotalFonse, MediaCorrenteNTotalSub)
Freezer_FonseNoturno = porcentagem(
MediaCorrenteNTotalFreezer, MediaCorrenteNTotalFonse)
Fonse_Subestação = porcentagem(MediaCorrenteTotalFonse, MediaCorrenteTotalSub)
Freezer_Fonse = porcentagem(MediaCorrenteTotalFreezer, MediaCorrenteTotalFonse)
Fonse_Geração = porcentagem(
MediaCorrenteTotalSegundoD, MediaCorrenteTotalFonse)
Subestação_Geração = porcentagem(
MediaCorrenteTotalPrimeiroD, MediaCorrenteTotalSub)
print('Relações:\n')
print('Fonse - Subestação =', Fonse_Subestação,
'%, Freezer - Fonse =', Freezer_Fonse, '%\n')
print('Fonse - Subestação Diurno =', Fonse_SubestaçãoDiurno,
'%, Freezer - Fonse Diurno =', Freezer_FonseDiurno, '%\n')
print('Fonse - Subestação Noturno =', Fonse_SubestaçãoNoturno,
'%, Freezer - Fonse Noturno =', Freezer_FonseNoturno, '%\n')
print('Geração - Fonse =', Fonse_Geração, '%\n')
print('Geração - Subestação =', Subestação_Geração, '%\n')
MaximoHoraSub = Subestação['Data'].max()
MinimoHoraSub = Subestação['Data'].min()
MaximoHoraFonse = FonseTotal['Data'].max()
MinimoHoraFonse = FonseTotal['Data'].min()
MaximoHoraFreezer = FonseFreezer['Data'].max()
MinimoHoraFreezer = FonseFreezer['Data'].min()
QHorasSub = Horas(MaximoHoraSub, MinimoHoraSub)
QHorasFonse = Horas(MaximoHoraFonse, MinimoHoraFonse)
QHorasFreezer = Horas(MaximoHoraFreezer, MinimoHoraFreezer)
resultanteR = potenciaParcial(FonseTotal['Pot R KW'])
resultanteS = potenciaParcial(FonseTotal['Pot S KW'])
resultanteT = potenciaParcial(FonseTotal['Pot T KW'])
PotenciaTotalRSub = potenciaParcial(Subestação['Pot R KW'])
PotenciaTotalSSub = potenciaParcial(Subestação['Pot S KW'])
PotenciaTotalTSub = potenciaParcial(Subestação['Pot T KW'])
PotenciaTotalRFonse = potenciaParcial(FonseTotal['Pot R KW'])
PotenciaTotalSFonse = potenciaParcial(FonseTotal['Pot S KW'])
PotenciaTotalTFonse = potenciaParcial(FonseTotal['Pot T KW'])
PotenciaTotalRFreezer = potenciaParcial(FonseFreezer['Pot R KW'])
PotenciaTotalSFreezer = potenciaParcial(FonseFreezer['Pot S KW'])
PotenciaTotalTFreezer = potenciaParcial(FonseFreezer['Pot T KW'])
PotenciaTotalSub = (PotenciaTotalRSub + PotenciaTotalSSub +
PotenciaTotalTSub) / np.sqrt(3)
PotenciaTotalFonse = (PotenciaTotalRFonse + PotenciaTotalSFonse +
PotenciaTotalTFonse) / np.sqrt(3)
PotenciaTotalFreezer = (PotenciaTotalRFreezer + PotenciaTotalSFreezer +
PotenciaTotalTFreezer) / np.sqrt(3)
kwhTotaisSub = (PotenciaTotalSub * QHorasSub)
kwhTotaisFonse = (PotenciaTotalFonse * QHorasFonse)
kwhTotaisFreezer = (PotenciaTotalFreezer * QHorasFreezer)
print('Relações kWh:\n')
print('Subestação ', kwhTotaisSub, 'kWh \n')
print('Fonse', kwhTotaisFonse, 'kWh \n')
print('Freezer', kwhTotaisFreezer, 'kWh \n')